import time

# 方法1
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.remote.switch_to import SwitchTo

# 引入action chains
from selenium.webdriver.common.action_chains import ActionChains

wd = webdriver.Chrome(service=Service(".\chromedriver_win136.exe"))

# wd.get("https://www.w3schools.com/html/html5_draganddrop.asp")
wd.get("https://demo.automationtesting.in/Static.html")

time.sleep(3)
# ele = wd.find_element(By.CSS_SELECTOR, "#slider")
source = wd.find_element(By.CSS_SELECTOR, "#dragarea")
destination = wd.find_element(By.CSS_SELECTOR, "#droparea")
item1 = wd.find_element(By.CSS_SELECTOR, "#angular")
item2 = wd.find_element(By.CSS_SELECTOR, "#mongo")
time.sleep(3)
ac = ActionChains(wd)
ac.click_and_hold(item1).move_to_element(destination).release().perform()
time.sleep(1)
ac.click_and_hold(item2).move_to_element(destination).release().perform()
# ac.drag_and_drop(item, destination).perform()
time.sleep(10)
